package com.e2oto.seller.modules;

import android.app.Application;
import android.content.Context;
import android.content.pm.PackageManager;


/**
 * Created by ZhangLiQiang on 2017/8/1.
 */

public class SellerApp extends Application {

    public static String versionCode;
    public static String versionName;
    public static String userId;
    public static String sellerId;

    @Override
    public void onCreate() {
        super.onCreate();
        initVersionInfo(getApplicationContext());
    }

    /**
     * 获取当前本地apk的版本
     *
     * @param mContext
     * @return
     */
    public void initVersionInfo(Context mContext) {
        try {
            //获取软件版本号，对应AndroidManifest.xml下android:versionCode
            versionCode = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionCode + "";
            //获取APP版本versionCode
            versionName = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionName;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
    }

}

